function reverseStr(str) {
  let res = '';
  let needReverse = '';
  function reverse(str) {
    for (let i = str.length - 1; i >= 0; i--) {
      res += str[i];
    }
  }
  for (let i = 0; i < str.length; i++) {
    if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z')) {
      reverse(needReverse);
      res += str[i];
      needReverse = '';
    } else {
      needReverse += str[i];
    }
  }
  return res;
}

console.log(reverseStr('123abd3-adfz-34-akjkfaf'))